Optimal. Leaf size=123 \[ \frac {\left (a^2+4 b^2\right ) \tanh ^{-1}(\cos (c+d x))}{8 d}+\frac {2 a b \cot (c+d x)}{3 d}+\frac {\left (a^2-2 b^2\right ) \cot (c+d x) \csc (c+d x)}{8 d}-\frac {a b \cot (c+d x) \csc ^2(c+d x)}{6 d}-\frac {\cot (c+d x) \csc ^3(c+d x) (a+b \sin (c+d x))^2}{4 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.23, antiderivative size = 123, normalized size of antiderivative = 1.00, number of steps
used = 8, number of rules used = 8, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.276, Rules used = {2968, 3127,
3110, 3100, 2827, 3852, 8, 3855} \begin {gather*} \frac {\left (a^2+4 b^2\right ) \tanh ^{-1}(\cos (c+d x))}{8 d}+\frac {\left (a^2-2 b^2\right ) \cot (c+d x) \csc (c+d x)}{8 d}+\frac {2 a b \cot (c+d x)}{3 d}-\frac {a b \cot (c+d x) \csc ^2(c+d x)}{6 d}-\frac {\cot (c+d x) \csc ^3(c+d x) (a+b \sin (c+d x))^2}{4 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 2827
Rule 2968
Rule 3100
Rule 3110
Rule 3127
Rule 3852
Rule 3855
Rubi steps
\begin {align*} \int \cot ^2(c+d x) \csc ^3(c+d x) (a+b \sin (c+d x))^2 \, dx &=\int \csc ^5(c+d x) (a+b \sin (c+d x))^2 \left (1-\sin ^2(c+d x)\right ) \, dx\\ &=-\frac {\cot (c+d x) \csc ^3(c+d x) (a+b \sin (c+d x))^2}{4 d}+\frac {1}{4} \int \csc ^4(c+d x) (a+b \sin (c+d x)) \left (2 b-a \sin (c+d x)-3 b \sin ^2(c+d x)\right ) \, dx\\ &=-\frac {a b \cot (c+d x) \csc ^2(c+d x)}{6 d}-\frac {\cot (c+d x) \csc ^3(c+d x) (a+b \sin (c+d x))^2}{4 d}-\frac {1}{12} \int \csc ^3(c+d x) \left (3 \left (a^2-2 b^2\right )+8 a b \sin (c+d x)+9 b^2 \sin ^2(c+d x)\right ) \, dx\\ &=\frac {\left (a^2-2 b^2\right ) \cot (c+d x) \csc (c+d x)}{8 d}-\frac {a b \cot (c+d x) \csc ^2(c+d x)}{6 d}-\frac {\cot (c+d x) \csc ^3(c+d x) (a+b \sin (c+d x))^2}{4 d}-\frac {1}{24} \int \csc ^2(c+d x) \left (16 a b+3 \left (a^2+4 b^2\right ) \sin (c+d x)\right ) \, dx\\ &=\frac {\left (a^2-2 b^2\right ) \cot (c+d x) \csc (c+d x)}{8 d}-\frac {a b \cot (c+d x) \csc ^2(c+d x)}{6 d}-\frac {\cot (c+d x) \csc ^3(c+d x) (a+b \sin (c+d x))^2}{4 d}-\frac {1}{3} (2 a b) \int \csc ^2(c+d x) \, dx-\frac {1}{8} \left (a^2+4 b^2\right ) \int \csc (c+d x) \, dx\\ &=\frac {\left (a^2+4 b^2\right ) \tanh ^{-1}(\cos (c+d x))}{8 d}+\frac {\left (a^2-2 b^2\right ) \cot (c+d x) \csc (c+d x)}{8 d}-\frac {a b \cot (c+d x) \csc ^2(c+d x)}{6 d}-\frac {\cot (c+d x) \csc ^3(c+d x) (a+b \sin (c+d x))^2}{4 d}+\frac {(2 a b) \text {Subst}(\int 1 \, dx,x,\cot (c+d x))}{3 d}\\ &=\frac {\left (a^2+4 b^2\right ) \tanh ^{-1}(\cos (c+d x))}{8 d}+\frac {2 a b \cot (c+d x)}{3 d}+\frac {\left (a^2-2 b^2\right ) \cot (c+d x) \csc (c+d x)}{8 d}-\frac {a b \cot (c+d x) \csc ^2(c+d x)}{6 d}-\frac {\cot (c+d x) \csc ^3(c+d x) (a+b \sin (c+d x))^2}{4 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(579\) vs. \(2(123)=246\).
time = 6.14, size = 579, normalized size = 4.71 \begin {gather*} \frac {a b \cot \left (\frac {1}{2} (c+d x)\right ) (b+a \csc (c+d x))^2 \sin ^2(c+d x)}{3 d (a+b \sin (c+d x))^2}+\frac {\left (a^2-4 b^2\right ) \csc ^2\left (\frac {1}{2} (c+d x)\right ) (b+a \csc (c+d x))^2 \sin ^2(c+d x)}{32 d (a+b \sin (c+d x))^2}-\frac {a b \cot \left (\frac {1}{2} (c+d x)\right ) \csc ^2\left (\frac {1}{2} (c+d x)\right ) (b+a \csc (c+d x))^2 \sin ^2(c+d x)}{12 d (a+b \sin (c+d x))^2}-\frac {a^2 \csc ^4\left (\frac {1}{2} (c+d x)\right ) (b+a \csc (c+d x))^2 \sin ^2(c+d x)}{64 d (a+b \sin (c+d x))^2}+\frac {\left (a^2+4 b^2\right ) (b+a \csc (c+d x))^2 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right ) \sin ^2(c+d x)}{8 d (a+b \sin (c+d x))^2}+\frac {\left (-a^2-4 b^2\right ) (b+a \csc (c+d x))^2 \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right ) \sin ^2(c+d x)}{8 d (a+b \sin (c+d x))^2}+\frac {\left (-a^2+4 b^2\right ) (b+a \csc (c+d x))^2 \sec ^2\left (\frac {1}{2} (c+d x)\right ) \sin ^2(c+d x)}{32 d (a+b \sin (c+d x))^2}+\frac {a^2 (b+a \csc (c+d x))^2 \sec ^4\left (\frac {1}{2} (c+d x)\right ) \sin ^2(c+d x)}{64 d (a+b \sin (c+d x))^2}-\frac {a b (b+a \csc (c+d x))^2 \sin ^2(c+d x) \tan \left (\frac {1}{2} (c+d x)\right )}{3 d (a+b \sin (c+d x))^2}+\frac {a b (b+a \csc (c+d x))^2 \sec ^2\left (\frac {1}{2} (c+d x)\right ) \sin ^2(c+d x) \tan \left (\frac {1}{2} (c+d x)\right )}{12 d (a+b \sin (c+d x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.26, size = 142, normalized size = 1.15
method | result | size |
derivativedivides | \(\frac {a^{2} \left (-\frac {\cos ^{3}\left (d x +c \right )}{4 \sin \left (d x +c \right )^{4}}-\frac {\cos ^{3}\left (d x +c \right )}{8 \sin \left (d x +c \right )^{2}}-\frac {\cos \left (d x +c \right )}{8}-\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{8}\right )-\frac {2 a b \left (\cos ^{3}\left (d x +c \right )\right )}{3 \sin \left (d x +c \right )^{3}}+b^{2} \left (-\frac {\cos ^{3}\left (d x +c \right )}{2 \sin \left (d x +c \right )^{2}}-\frac {\cos \left (d x +c \right )}{2}-\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )}{d}\) | \(142\) |
default | \(\frac {a^{2} \left (-\frac {\cos ^{3}\left (d x +c \right )}{4 \sin \left (d x +c \right )^{4}}-\frac {\cos ^{3}\left (d x +c \right )}{8 \sin \left (d x +c \right )^{2}}-\frac {\cos \left (d x +c \right )}{8}-\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{8}\right )-\frac {2 a b \left (\cos ^{3}\left (d x +c \right )\right )}{3 \sin \left (d x +c \right )^{3}}+b^{2} \left (-\frac {\cos ^{3}\left (d x +c \right )}{2 \sin \left (d x +c \right )^{2}}-\frac {\cos \left (d x +c \right )}{2}-\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )}{d}\) | \(142\) |
risch | \(-\frac {-48 i a b \,{\mathrm e}^{6 i \left (d x +c \right )}+3 a^{2} {\mathrm e}^{7 i \left (d x +c \right )}-12 b^{2} {\mathrm e}^{7 i \left (d x +c \right )}+48 i a b \,{\mathrm e}^{4 i \left (d x +c \right )}+21 a^{2} {\mathrm e}^{5 i \left (d x +c \right )}+12 b^{2} {\mathrm e}^{5 i \left (d x +c \right )}-16 i a b \,{\mathrm e}^{2 i \left (d x +c \right )}+21 \,{\mathrm e}^{3 i \left (d x +c \right )} a^{2}+12 b^{2} {\mathrm e}^{3 i \left (d x +c \right )}+16 i a b +3 a^{2} {\mathrm e}^{i \left (d x +c \right )}-12 b^{2} {\mathrm e}^{i \left (d x +c \right )}}{12 d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{4}}+\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{8 d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right ) b^{2}}{2 d}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{8 d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right ) b^{2}}{2 d}\) | \(260\) |
norman | \(\frac {-\frac {a^{2}}{64 d}+\frac {a^{2} \left (\tan ^{12}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{64 d}-\frac {\left (a^{2}+4 b^{2}\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{32 d}+\frac {\left (a^{2}+4 b^{2}\right ) \left (\tan ^{10}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{32 d}-\frac {\left (a^{2}+16 b^{2}\right ) \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{32 d}-\frac {\left (a^{2}+16 b^{2}\right ) \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{32 d}-\frac {a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{12 d}+\frac {a b \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}+\frac {a b \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d}-\frac {a b \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d}-\frac {a b \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}+\frac {a b \left (\tan ^{11}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4} \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}-\frac {\left (a^{2}+4 b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{8 d}\) | \(287\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.28, size = 129, normalized size = 1.05 \begin {gather*} -\frac {3 \, a^{2} {\left (\frac {2 \, {\left (\cos \left (d x + c\right )^{3} + \cos \left (d x + c\right )\right )}}{\cos \left (d x + c\right )^{4} - 2 \, \cos \left (d x + c\right )^{2} + 1} - \log \left (\cos \left (d x + c\right ) + 1\right ) + \log \left (\cos \left (d x + c\right ) - 1\right )\right )} - 12 \, b^{2} {\left (\frac {2 \, \cos \left (d x + c\right )}{\cos \left (d x + c\right )^{2} - 1} + \log \left (\cos \left (d x + c\right ) + 1\right ) - \log \left (\cos \left (d x + c\right ) - 1\right )\right )} + \frac {32 \, a b}{\tan \left (d x + c\right )^{3}}}{48 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.38, size = 200, normalized size = 1.63 \begin {gather*} -\frac {32 \, a b \cos \left (d x + c\right )^{3} \sin \left (d x + c\right ) + 6 \, {\left (a^{2} - 4 \, b^{2}\right )} \cos \left (d x + c\right )^{3} + 6 \, {\left (a^{2} + 4 \, b^{2}\right )} \cos \left (d x + c\right ) - 3 \, {\left ({\left (a^{2} + 4 \, b^{2}\right )} \cos \left (d x + c\right )^{4} - 2 \, {\left (a^{2} + 4 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + a^{2} + 4 \, b^{2}\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + 3 \, {\left ({\left (a^{2} + 4 \, b^{2}\right )} \cos \left (d x + c\right )^{4} - 2 \, {\left (a^{2} + 4 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + a^{2} + 4 \, b^{2}\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{48 \, {\left (d \cos \left (d x + c\right )^{4} - 2 \, d \cos \left (d x + c\right )^{2} + d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: SystemError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.48, size = 182, normalized size = 1.48 \begin {gather*} \frac {3 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 16 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 24 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 48 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 24 \, {\left (a^{2} + 4 \, b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) + \frac {50 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 200 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 48 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 24 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 16 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 3 \, a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4}}}{192 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 9.33, size = 165, normalized size = 1.34 \begin {gather*} \frac {a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4}{64\,d}-\frac {\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (\frac {a^2}{8}+\frac {b^2}{2}\right )}{d}+\frac {b^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{8\,d}-\frac {{\mathrm {cot}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4\,\left (\frac {a^2}{4}-4\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\frac {4\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{3}+2\,b^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\right )}{16\,d}+\frac {a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{12\,d}-\frac {a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{4\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________